<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="/layouts/default.xhtml">
	<ui:define name="title">#{text['eleveList.title']}</ui:define>
	<ui:param name="menu" value="EleveMenu" />
	<ui:param name="menuleft" value="ElevesMenu"/>
	<ui:define name="bodyId">eleveList</ui:define>
	
	<ui:define name="body">
		<c:set var="delObject" value="#{text['eleveList.eleve']}" />
		<script type="text/javascript">
			var msgDelConfirm = "<h:outputFormat value="#{text['delete.confirm']}"><f:param value="#{delObject}" /></h:outputFormat>";
	    </script>
	    
		<div class="col-sm-12">
			<div class="page-header">
					<h3>#{text['eleveList.heading']}</h3>
			</div>
			<h:form id="editEleve">
				<div class="row">
					<div class="col-sm-2">
				        <h:commandLink action="#{eleveController.printListeEleve}"  rendered="#{p:ifGranted('ROLE_ADMIN')}">
							<p:graphicImage url="/images/pdf.png" title="#{text['eleveList.list.export']}"></p:graphicImage>
			  			</h:commandLink> 
					</div>
				</div>
		  		<br/>
				<p:dataTable id="eleves" var="eleve" value="#{eleveController.elevesResult}"
					sortBy="#{eleveController.sortColumn}" paginator="true" rows="25"
					paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="10,25,50">
					
					<p:column headerText="#{text['eleve.numInsc']}" sortBy="numeroInscription">
						<h:outputText value="#{eleve.numeroInscription}" escape="true" />
					</p:column>
					
					<p:column headerText="#{text['eleve.numInscNat']}" sortBy="numeroInscriptionNational">
						<h:outputText value="#{eleve.numeroInscriptionNational}" escape="true" />
					</p:column>
					
					<p:column headerText="#{text['eleve.nom']}" sortBy="fullName">
						<h:outputText value="#{eleve.fullName}" escape="true" />
					</p:column>
					
					<p:column headerText="#{text['eleve.prenomAr']}" sortBy="fullNameAr">
						<h:outputText value="#{eleve.fullNameAr}" escape="true" />
					</p:column>
					
					<p:column headerText="#{text['eleve.dateNaissance']}" sortBy="dateNaissance">
						<h:outputText value="#{eleve.dateNaissance}" escape="true">
							<f:convertDateTime pattern="#{text['date.format']}" />
						</h:outputText>
					</p:column>
					
					<p:column exportable="false">
						<div class="text-center">
							<h:commandLink action="#{paiementController.detailEleve}"
								title="#{text['button.view']}">
								<f:param name="id" value="#{eleve.id}" />
								<f:param name="from" value="list" />
								<span class="glyphicon glyphicon-eye-open"></span>
							</h:commandLink>
						</div>
					</p:column>
					
					<p:column rendered="#{p:ifGranted('ROLE_ADMIN')}" exportable="false">
						<div class="text-center">
							<h:commandLink action="#{eleveController.edit}"
								title="#{text['button.edit']}">
								<f:param name="id" value="#{eleve.id}" />
								<f:param name="from" value="list" />
								<span class="glyphicon glyphicon-pencil"></span>
							</h:commandLink>
						</div>
					</p:column>
					
					<p:column rendered="#{p:ifGranted('ROLE_ADMIN')}" exportable="false">
						<div class="text-center">
							<h:commandLink action="#{paiementController.edit}"
								title="#{text['button.addPay']}">
								<f:param name="idEleve" value="#{eleve.id}" />
								<f:param name="from" value="listEleve" />
								<span class="glyphicon glyphicon-plus"></span>
							</h:commandLink>
						</div>
					</p:column>
					
					<p:column rendered="#{p:ifGranted('ROLE_ADMIN')}" exportable="false">
						<div class="text-center">
							<h:commandLink action="#{eleveController.delete}" onclick="return confirmMessage(msgDelConfirm)"
								title="#{text['button.delete']}">
								<f:param name="id" value="#{eleve.id}" />
								<span class="glyphicon glyphicon-trash"></span>
							</h:commandLink>
						</div>
					</p:column>
				</p:dataTable>
			</h:form>
		</div>
	</ui:define>
</ui:composition>
</html>